package vista;

import controlador.ControladorEstadoPartes;

public class VistaEstadoPartes extends javax.swing.JFrame {
	   
		private javax.swing.JButton botonVolver;
	    private javax.swing.JLabel etiquetaMax;
	    private javax.swing.JLabel etiquetaMaxVida;
	    private javax.swing.JLabel jLabel1;
	    private javax.swing.JLabel jLabel2;
	    private javax.swing.JLabel jLabel3;
	    private javax.swing.JLabel jLabel4;
	    private javax.swing.JLabel jLabel5;
	    private javax.swing.JLabel jLabel6;
	    private javax.swing.JLabel jLabel7;
	    private javax.swing.JLabel jLabel8;
	    private javax.swing.JScrollPane jScrollPane1;
	    private javax.swing.JList listaPartes;
	    private javax.swing.JLabel etiquetaPerformance;
	    private javax.swing.JLabel etiquetaVel;
  
    public VistaEstadoPartes(ControladorEstadoPartes controlador) {
        initComponents();
        this.setVisible(true);
        this.setLocationRelativeTo(null); 
        botonVolver.addActionListener(controlador.getListenerBotonVolver());
        listaPartes.addListSelectionListener(controlador.getListenerListaPartes());
    }
    
    public void VistaEstadoPartesVisibilidadFalse(){
		this.setVisible(false);
    } 
    
    public void VistaEstadoPartesVisibilidadTrue(){
		etiquetaMax.setText("");
		jLabel6.setText("");
		jLabel4.setText("");
		etiquetaPerformance.setText("");
		etiquetaVel.setText("");
    	this.setVisible(true);
    }
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        listaPartes = new javax.swing.JList();
        jLabel2 = new javax.swing.JLabel();
        etiquetaMaxVida = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        etiquetaMax = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        botonVolver = new javax.swing.JButton();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        etiquetaPerformance = new javax.swing.JLabel();
        etiquetaVel = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Car Tunning Experience 2008");

        jLabel1.setFont(new java.awt.Font("Century Gothic", 0, 24));
        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabel1.setText("ESTADO DE PARTES");

        jScrollPane1.setViewportView(listaPartes);

        jLabel2.setFont(new java.awt.Font("Century Gothic", 0, 12));
        jLabel2.setText("MAXIMA VIDA UTIL:");

        etiquetaMaxVida.setFont(new java.awt.Font("Century Gothic", 0, 12));

        jLabel3.setFont(new java.awt.Font("Century Gothic", 0, 12));
        jLabel3.setText("VIDA UTIL:");

        jLabel4.setFont(new java.awt.Font("Century Gothic", 0, 12));

        etiquetaMax.setFont(new java.awt.Font("Century Gothic", 0, 12));

        jLabel5.setFont(new java.awt.Font("Century Gothic", 0, 12));
        jLabel5.setText("COMBUSTIBLE:");

        jLabel6.setFont(new java.awt.Font("Century Gothic", 0, 12));

        botonVolver.setText("VOLVER");

        jLabel7.setFont(new java.awt.Font("Century Gothic", 0, 12));
        jLabel7.setText("PERFORMANCE:");

        jLabel8.setFont(new java.awt.Font("Century Gothic", 0, 12));
        jLabel8.setText("VELOCIDAD MAXIMA:");

        etiquetaPerformance.setFont(new java.awt.Font("Century Gothic", 0, 12));

        etiquetaVel.setFont(new java.awt.Font("Century Gothic", 0, 12));

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(91, 91, 91)
                        .addComponent(jLabel1))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(41, 41, 41)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(157, 157, 157)
                                .addComponent(etiquetaMaxVida, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addGap(18, 18, 18)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                            .addComponent(jLabel2)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(etiquetaMax, javax.swing.GroupLayout.DEFAULT_SIZE, 91, Short.MAX_VALUE))
                                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                            .addComponent(jLabel3)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                            .addComponent(jLabel5)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(jLabel7)
                                        .addGap(18, 18, 18)
                                        .addComponent(etiquetaPerformance, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(jLabel8)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(etiquetaVel, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)))))))
                .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(164, Short.MAX_VALUE)
                .addComponent(botonVolver)
                .addGap(160, 160, 160))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(etiquetaMaxVida)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel7)
                                .addComponent(etiquetaPerformance, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel8)
                            .addComponent(etiquetaVel, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel2)
                            .addComponent(etiquetaMax, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel3)
                            .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel5)
                            .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(15, 15, 15))
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(26, 26, 26)
                .addComponent(botonVolver)
                .addGap(20, 20, 20))
        );

        pack();
    }                 
    
    public void llenarEtiquetas(String combustible,String vida,String max,String vel,String perf){
    	jLabel6.setText(combustible);
    	jLabel4.setText(max);
    	etiquetaMax.setText(vida);
    	etiquetaVel.setText(vel);
    	etiquetaPerformance.setText(perf);
    }
      
    public void llenarListaPartes (javax.swing.DefaultListModel jModel){
      	listaPartes.setModel(jModel);
      	}
   
    public int DevolverIndicePartes (){
 	   return listaPartes.getSelectedIndex();
     }
                     
                  
    
}

